#ifndef __HASHER
#define __HASHER
#include<vector>
#include<set>
#include<string>
#include<cmath>
#include<ctime>
#include<algorithm>
#include"io.h"
#include"huffman.h"
using namespace std;

namespace Hashing
{

	typedef long long ll;
	bool isPrime(unsigned int v)
	{
		for (unsigned int i=2;i*i<=v;++i)
			if (v%i==0)
				return false;
		return true;
	}

	class hasher
	{
		
	public:
		template<class T>
		static inline T value(const char *s, T mod) 
		{
			T v=0;
			for (int i=0;s[i];++i)
			{
				v=(((ll)v)*257ULL)%mod;
				v+=(unsigned char)s[i];
			}
			return v%mod;
		}
	};

}

#endif